<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" name="referrer" content="no-referrer">
    
    <title th:text="${question.title}"></title>
<!--    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap-theme.css" rel="stylesheet">-->
<!--    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.css" rel="stylesheet">-->
<!--    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.js"></script>-->
    <link th:href="@{/css/bootstrap.css}" rel="stylesheet">
    <link th:href="@{/css/bootstrap-theme.css}" rel="stylesheet">
    <link th:href="@{/css/profile.css}" rel="stylesheet">
    <link rel="stylesheet" href="/editor.md/css/editormd.preview.css" />

    <script th:src="@{/js/jquery-3.4.1.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/js/moment.js}"></script>
    <script src="/editor.md/editormd.js"></script>
    <script src="/editor.md/lib/marked.min.js"></script>
    <script src="/editor.md/lib/prettify.min.js"></script>
    <script th:src="@{/js/myhub.js}"></script>


</head>
<body>
<!--插入头部导航栏-->
<div th:replace="~{common/commons::topbar(active='')}"></div>
<div class="container-fluid main" >
    <div class="row profile_body" >
        <div class="col-lg-9 col-md-12 col-sm-12" id="main">
            <!--   问题主体部分    -->
            <div class="question">
                <div class="q_head">
                <h3><span th:text="${question.title}"></span></h3>
                <span class="text-desc">
                作者: <span th:text="${question.user.name}"></span>&nbsp;
                阅读: <span th:text="${question.viewCount}"></span>&nbsp;
                喜欢: <span th:text="${question.likeCount}"></span>&nbsp;
                发布: <span th:text="${#dates.format(question.gmtCreate,'yyy-MM-dd hh:mm:ss')}"></span>
                </span>
                </div>
                <div class="hotTags">
                    <span class="label label-info tags" th:each="tag:${question.tag.split(',')}">
                        <a th:href="@{/index(tag=${tag})}">
                            <span class="tag-tag" th:text="${tag}"></span>
                        </a>
                    </span>
                </div>
                <hr>
                <!--    内容展示            -->
                <div id="markdown-view">
                    <label>
                        <textarea style="display:none;" th:text="${question.description}"></textarea>
                    </label>
                </div>
                <script type="text/javascript">
                    markdown_view();
                </script>
                <p>
                <!-- 编辑删除-->
                <div th:if="${session.user!=null&&question.creator==session.user.id}">
                    <a class="pull-right" onclick="return confirm('确认要删除吗')" style="color: red" th:href="@{'/question/delete/'+ ${question.id}}"><span class="glyphicon glyphicon-remove-circle"></span>删除</a>
                    <a class="btn-edit"  th:href="@{'/question/edit/'+ ${question.id}}"><span class="glyphicon glyphicon-pencil"></span>编辑</a>
                </div>
                <p></p>
                <hr>
            </div>
            <!--    问题评论       -->
                <!--     展示评论      -->
                <div class="comment_count ">
                    <span class="qcomment"><a href="#comment"><img class="like" src="/images/comment.png" alt="#"></a><span th:text="${question.commentCount}"></span></span>
                    <span><img  class="like" id="isLike" th:attr="status=${question.isLike},likeId=${question.id}" onclick="submit_question_like()"
                          th:src="${(session.user!=null&&question.isLike==1)?'/images/is-like-active.png':'/images/is-like.png'}" alt="#">
                          <span id="questionLikeCount" th:text="${question.likeCount}"></span>
                    </span>
                </div>
            <br>

                <div class="media" th:if="${comments!=null}" th:each="comment:${comments}">
                <div class="media-left">
                    <a th:href="@{'/index?userId='+${comment.commenter}}" >
                        <img class="media-object comment_media"
                             th:src="${comment.user.avatarUrl}!=null?${comment.user.avatarUrl}:'/images/default.png'">
                    </a>
                </div>
                <div class="media-body">
                    <h5><span th:text="${comment.user.name}"></span></h5>
                    <div class="comments" th:text="${comment.content}">评论内容</div>
                    <div class="menu">
                        <a  onclick="submit_comment_like(this)" th:attr="cid = ${comment.id},like=${comment.likedStatus}"
                            th:class="${session.user!=null&&comment.likedStatus==1?'glyphicon glyphicon-thumbs-up icon like-active': 'glyphicon glyphicon-thumbs-up icon'}">
                        </a><span class="cCount" th:text="${comment.likeCount}" th:id="${'commentLike'+comment.id}"></span>
                        <span th:data-id="${comment.id}"
                              onclick="collapseComments(this)" class="comment-icon glyphicon glyphicon-comment"></span>
                        <span class="cCount" th:text="${comment.subCommentCount}"></span>
                        <span class="date pull-right" th:text="${#dates.format(comment.gmtCreate,'yyyy-MM-dd hh:mm:ss')}">创建日期</span>
                    </div>
                    <!--  二级评论   -->
                    <div class="col-lg-12 col-md-12 col-sm-12 collapse comment_l2" th:id="'comment-'+${comment.id}">
                        <!--二级评论主体,js拼接-->
                        <!--发布二级评论-->
                        <div>
                        <input class="form-control l2_c_form" type="text" placeholder="评论一下" th:id="'subComment_text'+${comment.id}">
                        <button type="button" class="btn btn-success btn-comment-l2"
                                th:attr="cid=${comment.id},qid=${question.id}"
                                onclick="post_sub_comment(this)">评论</button>
                        </div>
                    </div>
                </div>
                </div>
                <hr>
                <!--     写评论        -->
                <div class="media" th:if="${session.user!=null}">
                    <div class="media-left" >
                        <a th:href="@{'/index?userId='+${session.user.id}}">
                            <img class="media-object img-rounded comment_media"  alt="xx" th:src="${session.user.avatarUrl}!=null?${session.user.avatarUrl}:'/images/default.png'">
                        </a>
                    </div>
                    <div class="media-body">
                        <h5><span th:text="${session.user.name}"></span></h5>
                    </div>
                </div>
                <div id="comment">
                    <textarea id="comment_text" class="form-control" rows="4"  placeholder="输入评论内容"></textarea>
                    <input th:value="${question.id}" id="parent" hidden>
                    <button type="button" class="btn btn-success btn-comment" onclick="post_comment()">提交</button>
                </div>
        </div>

        <!--    右侧边    -->
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div><h4>发起人</h4></div>
            <hr>
            <div class="media">
                <div class="media-left" >
                    <a th:href="@{'/index?userId='+${question.creator}}">
                        <img class="media-object" id="head_img" alt="xx"
                             th:src="${question.user.avatarUrl}!=null?${question.user.avatarUrl}:'/images/default.png'">
                    </a>
                </div>
                <div class="media-body">
                    <span th:text="${question.user.name}"></span>
                </div>
            </div>
            <hr>
            <div><h4>相关话题</h4></div>
            <div>
                <ul class="q_related_ul">
                    <li class="q_related_li" th:if="${related!=null}"  th:each="relate:${related}">
                        <a th:href="@{'/question/'+${relate.id}}" th:text="${relate.title}"></a>
                    </li>
                </ul>
            </div>
            <hr>
            <div th:replace="~{common/commons::sidebar}"></div>
    </div>

</div>
</div>
<div th:replace="~{common/commons::foot}"></div>
<script>
    $(function () {
        flex();
        removeEmptyLabel();
    })
</script>
</body>
</html>
